package com.lanou3g.dllo.baidumusic.tools;

import android.content.Context;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;
import com.lanou3g.dllo.baidumusic.musiclibrary.playlist.PlaylistMemoryCache;

/**
 * Created by dllo on 16/6/22.
 */
public class SingleVolley {

    private static SingleVolley singleVolley;
    private RequestQueue requestQueue;
    private ImageLoader imageLoader;

    public RequestQueue getRequestQueue() {
        return requestQueue;
    }

    public ImageLoader getImageLoader() {
        return imageLoader;
    }

    private SingleVolley(Context context) {

        requestQueue = Volley.newRequestQueue(context);
        imageLoader = new ImageLoader(requestQueue, new PlaylistMemoryCache());


    }

    public static SingleVolley getSingleVolley(Context context) {
        if (singleVolley == null) {
            synchronized (SingleVolley.class) {
                if (singleVolley == null) {
                    singleVolley = new SingleVolley(context);
                }
            }
        }

        return singleVolley;
    }



}
